Ext.define('FirstMate.store.TideStations', {
	requires : ['FirstMate.model.TideStation'],
	extend : 'Ext.data.Store',
	config : {
		storeId: 'tidesStationsStore',	   
		model : 'FirstMate.model.TideStation',
		proxy : {
			type: 'jsonp',
			callbackKey : '.jsonp',
			autoAppendParams : false,
			enablePagingParams : false,
			noCache : false,                               
			url : 'http://coastwatch.pfeg.noaa.gov/erddap/tabledap/nosCoopsWLTPHL.json?' +
			'stationID,stationName,longitude,latitude' +
			'&distinct()',
			reader: new Ext.data.reader.Array({
				type: 'json',
				rootProperty: 'table.rows'
			})
		}
		
	},
	
	filterByGeoBounds: function(bounds){
		
		this.clearFilter();
		this.filterBy(function(record){
			if (bounds.contains(new google.maps.LatLng(record.get('latitude'),record.get('longitude')))){
				return true;
				}
		});
		
	}
});
